package com.alice.util;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class RestResponse<T> {

    @ApiModelProperty(value = "返回码", required = true)
    private Integer code;
    @ApiModelProperty(value = "返回消息", required = false)
    private String msg;

    @ApiModelProperty(value = "返回参数", required = false)
    private T data;


    public static RestResponse ok(Object data){
        return new RestResponse(200,"操作成功！",data);
    }

    public static RestResponse fail(){
        return new RestResponse(201,"操作失败！",null);
    }
}
